@extends('layouts.backend')
@section('title')
    角色授权
@endsection

@section('body')
    <div class="row">
        <div class="ibox">
            <div class="ibox-title">
                <h5>角色授权({{$role->name}})</h5>
                <a href="{{route('backend.role.index')}}" class="btn btn-primary pull-right">返回列表</a>
                <div class="clearfix"></div>
            </div>
            <div class="ibox-content">

                <div class="row m-sm">
                    <div class="col-md-8">
                        <form method="post" class="form-horizontal" >
                            @csrf
                            <div class="form-group">
                                @foreach($permissions as $permission)
                                <label class="checkbox-inline m-md" for="permission_{{$permission->id}}">
                                    <input type="checkbox" value="{{$permission->name}}" id="permission_{{$permission->id}}"
                                           {{ $role->hasAnyPermission($permission->name,$role->guard_name)  ? 'checked' : '' }} name="permission_names[]"  />
                                    {{$permission->display_name}}
                                </label>

                                @endforeach
                            </div>


                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2 pull-right">
                                    <button class="btn btn-primary" type="submit">添加</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>

            </div>
        </div>
    </div>
@endsection
